package com.lorenzogao.pley.common.rx.subscriber

import android.content.Context
import com.lorenzogao.pley.ui.BaseView
import io.reactivex.disposables.Disposable


abstract class ProgressSubcriber<T>(context: Context, view: BaseView) : ErrorHandlerSubscriber<T>(context) {


    private val isShowProgress: Boolean
        get() = true

    private var mView: BaseView = view

   override fun onSubscribe(d: Disposable) {

        if (isShowProgress) {
            mView.showLodading()
        }
    }

    override fun onComplete() {
        mView.dimissLoading()
    }


    override fun onError(e: Throwable?) {
        val baseException = mRxErrorHandler!!.handlerError(e!!)

        mView.showError(baseException.dispatymessage!!)

    }

}
